#ifndef GERENCIADORUDP_H
#define GERENCIADORUDP_H

//
// server.cpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#include <ctime>
#include <iostream>
#include <string>
#include <boost/array.hpp>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/asio.hpp>

using boost::asio::ip::udp;

class ComunicadorUDP
{
public:
  ComunicadorUDP(boost::asio::io_service& io_service);
  static unsigned m_porta;

private:
  void start_receive();

  void handle_receive(const boost::system::error_code& error,
      std::size_t /*bytes_transferred*/);

  void handle_send(boost::shared_ptr<std::string> message,
      const boost::system::error_code& error,
      std::size_t bytes_transferred);

  udp::socket socket_;
  udp::endpoint remote_endpoint_;
  boost::array<char, 1> recv_buffer_;
};
#endif // GERENCIADORUDP_H
